<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body layui-anim layui-anim-up">
        <form class="layui-form">
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="x-red">*</span>课程名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_email" name="course" required class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="x-red">*</span>开始时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_email" name="beginTime" pattern="^(2[0-3]|[01]?[0-9]):([0-5]?[0-9])$" required class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>00:00
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="x-red">*</span>结束时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_email" name="endTime" pattern="^(2[0-3]|[01]?[0-9]):([0-5]?[0-9])$" required class="layui-input">
                </div>

                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>00:00
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="x-red">*</span>星期
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_email" name="time" pattern="^(周一|周二|周三|周四|周五|周六|周日)$" required class="layui-input">
                </div>

                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>周一-周日
                </div>
            </div>
          <div class="layui-form-item">
              <label for="L_username" class="layui-form-label">
                  <span class="x-red">*</span>详情
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="L_username" name="detail" required lay-verify="nikename"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_pass" class="layui-form-label">
                  <span class="x-red">*</span>数量
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="L_pass" name="number" required lay-verify="pass"
                  autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>
              </div>
          </div>
          <div class="layui-form-item">
              <button  class="layui-btn sub" lay-filter="add" lay-submit="">
                  增加
              </button>
          </div>
      </form>
    </div>
    <script>
        let domData={
            sub:document.querySelector(".sub")
        }
        domData.sub.onclick=function () {
            console.log("进入教师添加")
            $.ajax({
                url:'/course/insCourse',
                data:$('form').serialize(),
                success:function (res) {
                    parent.location.href='/course/teaCoursePage'
                },
                error:function (res) {
                    alert(res.msg)
                    parent.location.href='/course/teaCoursePage'
                }
            })
        }
    </script>
  </body>

</html>